Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
Document
Toggle tree growth
@charset "UTF-8"; @import url(https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800); *, :after, :before { box-sizing: border-box; padding: 0; margin: 0; } @import 'normalize.css'; *, *:after, *:before { box-sizing: border-box; } body { display: grid; place-items: center; min-height: 100vh; font-family: 'SF Pro Text', 'SF Pro Icons', 'AOS Icons', 'Helvetica Neue', Helvetica, Arial, sans-serif, system-ui; } html { color-scheme: light dark; } [data-theme='light'] { color-scheme: light only; } [data-theme='dark'] { color-scheme: dark only; } body::before { --size: 45px; --line: color-mix(in lch, canvasText, transparent 70%); content: ''; height: 100vh; width: 100vw; position: fixed; background: linear-gradient( 90deg, var(--line) 1px, transparent 1px var(--size) ) 50% 50% / var(--size) var(--size), linear-gradient(var(--line) 1px, transparent 1px var(--size)) 50% 50% / var(--size) var(--size); mask: linear-gradient(-20deg, transparent 50%, white); top: 0; transform-style: flat; pointer-events: none; z-index: -1; } .bear-link { color: canvasText; position: fixed; top: 1rem; left: 1rem; width: 48px; aspect-ratio: 1; display: grid; place-items: center; opacity: 0.8; } :where(.x-link, .bear-link):is(:hover, :focus-visible) { opacity: 1; } .bear-link svg { width: 75%; } /* Utilities */ .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; } [for] { --active: 0; cursor: pointer; height: clamp(24px, var(--size) * 0.5px, 150px); width: clamp(48px, var(--size) * 1px, 300px); border-radius: 50%; position: relative; transition: background-color 0.25s; } [for]:is(:hover, :has(+ :focus-visible)) { background: color-mix(in lch, canvas, canvasText 15%); } .tree { overflow: visible !important; width: 60%; position: absolute; bottom: 50%; left: 50%; translate: -50% 10%; } :root:has(#tree:focus-visible) [for='tree'] { outline: 2px dashed green; } [for='tree'] { --ease: linear( 0 0%, 0.5007 7.21%, 0.7803 12.29%, 0.8883 14.93%, 0.9724 17.63%, 1.0343 20.44%, 1.0754 23.44%, 1.0898 25.22%, 1.0984 27.11%, 1.1014 29.15%, 1.0989 31.4%, 1.0854 35.23%, 1.0196 48.86%, 1.0043 54.06%, 0.9956 59.6%, 0.9925 68.11%, 1 100% ); } :root:has(#tree:checked) [for='tree'] { --active: 1; --ease: linear( 0 0%, 0.0075 31.89%, 0.0044 40.4%, -0.0043 45.94%, -0.0196 51.14%, -0.0854 64.77%, -0.0989 68.6%, -0.1014 70.85%, -0.0984 72.89%, -0.0898 74.78%, -0.0754 76.56%, -0.0343 79.56%, 0.0276 82.37%, 0.1117 85.07%, 0.2197 87.71%, 0.4993 92.79%, 1 100% ); } .tree__layer, .tree__hole { transform-box: fill-box; transform-origin: 50% 100%; transition: scale, translate; transition-duration: calc((var(--speed, 0.5) + (var(--i, 0) * 0.075)) * 1s); transition-timing-function: var(--ease); } .tree__hole { transform-origin: 50% 50%; } .tree__layer:nth-of-type(1) { --i: 0; scale: calc(1 - (var(--active) * 0)); translate: 0 calc(var(--active) * 35%); } .tree__layer:nth-of-type(2) { --i: 1; scale: calc(1 + (var(--active) * 0.25)); translate: 0 calc(var(--active) * 90%); } .tree__layer:nth-of-type(3) { --i: 2; scale: calc(1 + (var(--active) * 0.675)); translate: 0 calc(var(--active) * 190%); } .tree__hole { scale: calc(0.65 + (var(--active) * 0.75)); }
console.log("Event Fired") import { Pane } from 'https://cdn.skypack.dev/tweakpane' const config = { theme: 'system', speed: 0.5, size: 96, } const ctrl = new Pane({ title: 'Config', expanded: true, }) ctrl.addBinding(config, 'theme', { label: 'Theme', options: { System: 'system', Light: 'light', Dark: 'dark', }, }) ctrl.addBinding(config, 'size', { min: 48, max: 300, step: 1, label: 'Size (px)', }) ctrl.addBinding(config, 'speed', { min: 0, max: 5, step: 0.01, label: 'Speed (s)', }) const update = () => { document.documentElement.dataset.theme = config.theme document.documentElement.style.setProperty('--speed', config.speed) document.documentElement.style.setProperty('--size', config.size) } const sync = (event) => { if ( !document.startViewTransition || !event || (event && event.target.controller.view.labelElement.innerText !== 'Theme') ) return update() document.startViewTransition(update) } sync() ctrl.on('change', sync)